'use strict';
const bcrypt = require('bcryptjs'); // 引入 bcryptjs 库

module.exports = {
  async up(queryInterface, Sequelize) {
    const hashedPasswordJohn = await bcrypt.hash('securepassword123', 10); // 假设这是 John Doe 的密码
    const hashedPasswordJane = await bcrypt.hash('anotherpassword456', 10); // 假设这是 Jane Smith 的密码
    const hashedPasswordAlex = await bcrypt.hash('mypassword789', 10); // 假设这是 Alex Johnson 的密码

    await queryInterface.bulkInsert(
      'users',
      [
        {
          avatar: 'https://example.com/avatar1.jpg',
          sex: 'male',
          introduce: 'Hello, I am John Doe.',
          username: 'johndoe',
          phone: '+1234567890',
          email: 'johndoe@example.com',
          password: hashedPasswordJohn,
          created_at: new Date(),
          updated_at: new Date(),
        },
        {
          avatar: 'https://example.com/avatar2.jpg',
          sex: 'female',
          introduce: 'Hi there! My name is Jane Smith.',
          username: 'janesmith',
          phone: '+0987654321',
          email: 'janesmith@example.com',
          password: hashedPasswordJane,
          created_at: new Date(),
          updated_at: new Date(),
        },
        {
          avatar: 'https://example.com/avatar3.jpg',
          sex: 'other',
          introduce: 'Greetings! Call me Alex Johnson.',
          username: 'alexjohnson',
          phone: '+1122334455',
          email: 'alexjohnson@example.com',
          password: hashedPasswordAlex,
          created_at: new Date(),
          updated_at: new Date(),
        },
      ],
      {}
    );
  },

  async down(queryInterface, Sequelize) {
    await queryInterface.bulkDelete('users', null, {});
  }
};